/*
 * PyGeoDatabase.cpp
 *
 *  Created on: Dec 28, 2011
 *      Author: allan
 */

#include "PyGeoDatabase.h"

// GeoReact includes
#include <GeoReact.h>

// Boost includes
#include <boost/python.hpp>
using namespace boost::python;

// PyGeoReact includes
#include <Common/PyBoostOptional.h>

void export_GeoDatabase()
{
	class_<ReactionData>("ReactionData")
		.def_readwrite("reactant",
			&ReactionData::reactant)
			
		.def_readwrite("products",
			&ReactionData::products)
		
		.def_readwrite("logK",
			&ReactionData::logK);
	
	
	class_<SpeciesData>("SpeciesData")
		.def_readwrite("name",
			&SpeciesData::name)
			
		.def_readwrite("phase",
			&SpeciesData::phase)
			
		.def_readwrite("elemental_composition",
			 &SpeciesData::elemental_composition)
			 
		.def_readwrite("molecular_weight",
			&SpeciesData::molecular_weight)
			
		.def_readwrite("volumetric_weigth",
			&SpeciesData::volumetric_weigth)
			
		.def_readwrite("radius",
			&SpeciesData::radius);
	
	
	class_<ComplexData>("ComplexData")
		.def_readwrite("name",
			&ComplexData::name)
			
		.def_readwrite("composition",
			&ComplexData::composition);
	
	
	class_<GeoDatabase>("GeoDatabase", no_init)
		.def("SetDatabasePath",
			&GeoDatabase::SetDatabasePath)
		
		.add_static_property("path", GeoDatabase::GetDatabasePath, GeoDatabase::SetDatabasePath)
		
		.def("GetInstance",
			&GeoDatabase::GetInstance,
				return_value_policy<reference_existing_object>())
				
		.def("ElectricalCharge",
			&GeoDatabase::ElectricalCharge)
			
		.def("ElementAtoms",
			&GeoDatabase::ElementAtoms)
			
		.def("FindReaction",
			&GeoDatabase::FindReaction)
			
		.def("FindSpecies",
			&GeoDatabase::FindSpecies)
			
		.def("FindComplex",
			&GeoDatabase::FindComplex)
			
		.def("ElementAtoms",
			&GeoDatabase::ElementAtoms)
		
		.staticmethod("SetDatabasePath")
		.staticmethod("GetInstance")
		.staticmethod("ElectricalCharge")
		.staticmethod("ElementAtoms");
	
	
	def("SpeciateSpecies",
		&SpeciateSpecies);
	
	def("SpeciateAqueousSpecies",
		&SpeciateAqueousSpecies);
	
	def("SpeciateGaseousSpecies",
		&SpeciateGaseousSpecies);
	
	def("SpeciateMineralSpecies",
		&SpeciateMineralSpecies);
	
	def("SpeciateBasisSpecies",
		&SpeciateBasisSpecies);
	
	def("SpeciateSecondarySpecies",
		&SpeciateSecondarySpecies);
	
	init_converter_boost_optional_tofrom_python_object<ReactionData>();
	init_converter_boost_optional_tofrom_python_object<SpeciesData>();
	init_converter_boost_optional_tofrom_python_object<ComplexData>();
}


